package com.mail.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain=true)
@TableName("mail")
public class Mail implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private Long userId;
    private String accountEmail;
    private String emailType;
    private String title;
    private String emailContent;
    private String regularTime;
    private String toMail;
    private String personOrTeam;
    private Long teamId;
    private String sendMailName;
    private String receiveMailName;
    private String status;

    //创建时间
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    //更新时间
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    //创建人
    @TableField(fill = FieldFill.INSERT)
    private Long createUser;


    //修改人
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;

    public Mail(Long userId, String accountEmail, String title, String emailContent, String regularTime, String toMail, String personOrTeam, Long teamId, String sendMailName, String receiveMailName) {
        this.userId = userId;
        this.accountEmail = accountEmail;
        this.title = title;
        this.emailContent = emailContent;
        this.regularTime = regularTime;
        this.toMail = toMail;
        this.personOrTeam = personOrTeam;
        this.teamId = teamId;
        this.sendMailName = sendMailName;
        this.receiveMailName = receiveMailName;
    }

    public Mail(Long userId, String accountEmail, String title, String emailContent, String regularTime, String toMail, String personOrTeam, String sendMailName, String receiveMailName) {
        this.userId = userId;
        this.accountEmail = accountEmail;
        this.title = title;
        this.emailContent = emailContent;
        this.regularTime = regularTime;
        this.toMail = toMail;
        this.personOrTeam = personOrTeam;
        this.sendMailName = sendMailName;
        this.receiveMailName = receiveMailName;
    }

    public Mail(Long userId, String accountEmail, String emailType, String title, String emailContent, String regularTime, String toMail, String personOrTeam, Long teamId, String sendMailName, String receiveMailName) {
        this.userId = userId;
        this.accountEmail = accountEmail;
        this.emailType = emailType;
        this.title = title;
        this.emailContent = emailContent;
        this.regularTime = regularTime;
        this.toMail = toMail;
        this.personOrTeam = personOrTeam;
        this.teamId = teamId;
        this.sendMailName = sendMailName;
        this.receiveMailName = receiveMailName;
    }

    public Mail(Long userId, String accountEmail, String emailType, String title, String emailContent, String regularTime, String toMail, String personOrTeam, String sendMailName, String receiveMailName) {
        this.userId = userId;
        this.accountEmail = accountEmail;
        this.emailType = emailType;
        this.title = title;
        this.emailContent = emailContent;
        this.regularTime = regularTime;
        this.toMail = toMail;
        this.personOrTeam = personOrTeam;
        this.sendMailName = sendMailName;
        this.receiveMailName = receiveMailName;
    }
}
